<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <script src="../js/vue.js"></script>
</head>

<body>
  <div id="root">
    <school></school>
  </div>
</body>

<script>
  Vue.config.productionTip = false

  // 定义school组件
  const school = Vue.extend(
    {
      name: 'school',
      template: `
    <div>
      <h2>学校名称：{{name}}</h2>
      <h2>学校地址：{{address}}</h2>
      <button @click='showName'>点我提示学校名</button>
    </div>
    `,
      data() {
        return {
          name: 'gzhu',
          address: 'gz'
        }
      },
      methods: {
        showName() {
          console.log("showName", this)
        }
      },
    }
  )


  new Vue({
    el: '#root',
    components: { school }
  })
</script>

</html>